<?php

/*************************************************************************
 * Zero PHP
 * Copyright (c) 2012
 * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
 * Author: zlk
 *************************************************************************/
abstract class CController extends CZero {

	private $name = '';
	public function __construct() {

	}

	//初始化View对象
	abstract protected function initView();

	//获取当前控制器类名
	protected function getActionName() {
		if (empty ($this->name)) {
			// 获取Action名称
			$this->name = substr(get_class($this), 0, -6);
		}
		return $this->name;
	}

	//是否为ajax提交
	protected function isAjax() {
		if (isset ($_SERVER['HTTP_X_REQUESTED_WITH'])) {
			if ('XMLHttpRequest' == strtolower($_SERVER['HTTP_X_REQUESTED_WITH']))
				return true;
		}
		return false;
	}

	//
}
?>
